package com.seveneight.baijiesteward.adapter;

import android.content.Context;
import android.widget.TextView;

import com.seveneight.baijiesteward.R;
import com.seveneight.baijiesteward.bean.PayBackRecordBean;
import com.seveneight.baijiesteward.bean.RecordBean;
import com.seveneight.baijiesteward.utils.DateUtil;
import com.seveneight.baijiesteward.utils.StringFormat;

/**
 * Created by user1 on 2018/2/13.
 */

public class PayBackRecordAdapter extends ListBaseAdapter<PayBackRecordBean> {

    public PayBackRecordAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_record;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        TextView tv_type = holder.getView(R.id.tv_type);
        TextView tv_amount = holder.getView(R.id.tv_amount);
        TextView tv_date = holder.getView(R.id.tv_date);
        TextView tv_states = holder.getView(R.id.tv_states);
        PayBackRecordBean payBackRecordBean = mDataList.get(position);
        tv_type.setText(payBackRecordBean.getOrderNo());
        tv_amount.setText(StringFormat.formatNumber(payBackRecordBean.getAmount()));
        if (payBackRecordBean.getOrderStatus() == 0) {
            tv_states.setText("未知");
        } else if (payBackRecordBean.getOrderStatus() == 100) {
            tv_states.setText("交易成功");
        } else if (payBackRecordBean.getOrderStatus() == 101) {
            tv_states.setText("正在处理");
        } else if (payBackRecordBean.getOrderStatus() == 103){
            tv_states.setText("审核中");
        } else {
            tv_states.setText("交易失败");
        }
        tv_date.setText(DateUtil.formatDate(payBackRecordBean.getCreatorTime()));
    }
}
